<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;

header("Access-Control-Allow-Origin:*");
class Authcontroller extends Controller
{
    public function apitest()
    {
        return "<h1>Hello</h1><br><h2>This is API\AuthController'S APITEST</h2>";
    }



    public function carlist(Request $request){
        if($request->isMethod('get')){
            $status=0;
//            $age=array("Bill"=>"35","Steve"=>"37","Elon"=>"43");
            $message=array(
                array("id"=>"1",
                    "name"=>"奥迪",
                    "ctime"=>Carbon::now()->toDateTimeString(),),
                array("id"=>"2",
                    "name"=>"宝马",
                    "ctime"=>Carbon::now()->toDateTimeString(),)
            );
           return (compact('status','message'));
        }
    }

    public function caradd(Request $request){
        if($request->isMethod('post')){
            if($request->Input('name')!=''){
                $status=0;
                $message="添加成功";
                return (compact('status','message'));
            }
        }
    }

    public function carde(Request $request){
        
    }

}
